@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --green: #10b981;
    --green-glow: rgba(16, 185, 129, 0.6);
}

[data-theme="light"] {
    --bg-main: #f1f5f9; /* slate-100 */
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-hover: #f8fafc; /* slate-50 */
    --text-primary: #1e293b; /* slate-800 */
    --text-secondary: #475569; /* slate-600 */
    --border-color: #e2e8f0; /* slate-200 */
    --primary: #4f46e5; /* indigo-600 */
    --primary-hover: #4338ca; /* indigo-700 */
    --danger: #dc2626; /* red-600 */
    --danger-hover: #b91c1c; /* red-700 */
}

[data-theme="dark"] {
    --bg-main: #0f172a; /* slate-900 */
    --bg-card: #1e293b; /* slate-800 */
    --bg-header: #1e293b; /* slate-800 */
    --bg-hover: #334155; /* slate-700 */
    --text-primary: #f1f5f9; /* slate-100 */
    --text-secondary: #94a3b8; /* slate-400 */
    --border-color: #334155; /* slate-700 */
    --primary: #6366f1; /* indigo-500 */
    --primary-hover: #4f46e5; /* indigo-600 */
    --danger: #f87171; /* red-400 */
    --danger-hover: #ef4444; /* red-500 */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    padding-top: 64px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: var(--bg-header);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-content { display: flex; align-items: center; gap: 1.5rem; }
.header-actions { display: flex; align-items: center; gap: 1rem; }

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) { .container { grid-template-columns: 2fr 1fr; } }

.main-content { display: grid; grid-auto-rows: min-content; gap: 1.5rem; }

.card {
    background-color: var(--bg-card);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.rj45-port {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background-color: #334155;
    border-radius: 0.25rem;
    border-bottom: 4px solid #0f172a;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}
.rj45-port:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), 0 0 0 2px var(--primary); }
.rj45-port::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 30%; background: linear-gradient(to bottom, #94a3b8, #cbd5e1); border-top-left-radius: 0.25rem; border-top-right-radius: 0.25rem; }
.port-number { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 0.65rem; font-weight: 600; color: #f1f5f9; z-index: 10; }
.port-light { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; background-color: #64748b; border-radius: 50%; border: 1px solid #334155; transition: all 0.2s ease; }
.port-light.active { background-color: var(--green); box-shadow: 0 0 5px var(--green), 0 0 10px var(--green-glow); }

.sidebar {
    background-color: var(--bg-card);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    position: sticky;
    top: calc(64px + 1.5rem);
    align-self: start;
    max-height: calc(100vh - 64px - 3rem);
    overflow-y: auto;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-table-container { border: 1px solid var(--border-color); border-radius: 0.5rem; overflow-x: auto; }
.sidebar-table th { padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); background-color: var(--bg-hover); text-align: left; }
.sidebar-table td { padding: 0.75rem 1rem; font-size: 0.875rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.sidebar-table tbody tr:nth-child(even) { background-color: var(--bg-hover); }
.table-cell-editable { cursor: pointer; }
.table-cell-editable:focus { background-color: rgba(var(--primary), 0.1); outline: 2px solid var(--primary); outline-offset: -1px; }

.port-details-popup {
    position: absolute; z-index: 1100; background-color: #1e293b; color: #f8fafc; border: 1px solid #475569;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); border-radius: 0.5rem; padding: 0.75rem; width: 240px;
    pointer-events: none; display: none; font-size: 0.8rem; line-height: 1.5;
}
.port-details-popup h5 { font-weight: 700; margin-bottom: 0.5rem; font-size: 0.9rem; color: #ffffff; }
.port-details-popup p { color: #cbd5e1; margin-bottom: 0.25rem; }
.port-details-popup strong { color: #94a3b8; }

.tab-bar { display: flex; align-items: center; gap: 0.5rem; }
.tab { padding: 0.5rem 1rem; cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); background-color: transparent; border-radius: 0.375rem; transition: all 0.2s ease; }
.tab:hover { background-color: var(--bg-hover); color: var(--primary); }
.tab.active { color: #ffffff; background-color: var(--primary); }

.editable-title-input { outline: none; border: none; background: transparent; font-size: 1.25rem; font-weight: 600; color: var(--text-primary); padding: 2px; margin: -2px; width: 100%; border-radius: 4px; }
.editable-title-input:focus { background-color: var(--bg-hover); }
.editable-office-title { font-size: 0.875rem; font-weight: 600; color: inherit; padding: 0; margin: 0; background: transparent; outline: none; border: none; text-align: center; }

.add-tab-button {
    display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
    background-color: transparent; border: 1px dashed var(--border-color); border-radius: 0.375rem; color: var(--text-secondary); transition: all 0.2s ease;
}
.add-tab-button:hover { border-color: var(--primary); color: var(--primary); }

/* Modal Styles */
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}
.modal-overlay.visible {
    display: flex;
    opacity: 1;
}
.modal-content {
    background-color: var(--bg-card);
    padding: 1.5rem 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 450px;
    transform: scale(0.95);
    transition: transform 0.2s ease-in-out;
}
.modal-overlay.visible .modal-content {
    transform: scale(1);
}

/* Modal Buttons */
.modal-button-primary {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}
.modal-button-primary:hover {
    background-color: var(--primary-hover);
}
.modal-button-secondary {
    background-color: var(--bg-hover);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s;
}
.modal-button-secondary:hover {
    background-color: var(--border-color);
}
